package org.cfg;

import com.sojoys.artifact.build.data.base.BaseCfg;
import com.sojoys.artifact.tools.ToolMap;
import com.sojoys.artifact.tools.ToolCopy;
import com.sojoys.artifact.factory.bytebuff.IByteBuff;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.ArrayUtils;
import com.sojoys.artifact.tools.SK_String;
import com.xiaoleilu.hutool.util.StrUtil;
import com.sojoys.artifact.constant.DataModelKeyEnum;
/**
 * 无尽回廊关卡
 */
public class EndlessCloisterLevelCfg extends BaseCfg<EndlessCloisterLevelCfg> {

	/**
	 * 数据库表名称
	 */
	public static final String TABLE_NAME = "endless_cloister_level";
	/**
	 * 完整类名称
	 */
	public static final String CLASS_NAME = "org.cfg.EndlessCloisterLevelCfg"; 
	/**
	 * 字段个数
	 */
	public static final int COLUMN_COUNT= 7;
	/**
	 * 数据库源字段注释
	 */
	public static final String[] SOURCE_COLUMN_REMARKS = new String[]{"","难度","奖励","关卡时长","层数奖励","排序","所属日期",};
	/**
	 * 数据库源字段名字
	 */
	public static final String[] SOURCE_COLUMN_NAMES = new String[]{"id","difficulty","reward","time","floorReward","order","week",};
	/**
	 * 拼音字段名字
	 */
	public static final String[] PINGYING_COLUMN_NAMES = new String[]{"id","difficulty","reward","time","floorReward","order","week",};
	/**
	 * HashCode字段名字
	 */
	public static final Integer[] HASHCODE_COLUMN_NAMES = new Integer[]{3355,1829500859,-934326481,3560141,-693885349,106006350,3645428,};
	/**
	 * 字段基本类型
	 */
	public static final String[] COLUMN_BASICTYPES = new String[]{"int","int","int","int","Map","int","int",};
	/**
	 * 字段引用类型
	 */
	public static final Class[] COLUMN_CLASSTYPES = new Class[]{Integer.class,Integer.class,Integer.class,Integer.class,Map.class,Integer.class,Integer.class,};
	
	/**
	 * id
	 */
	private int id;
	
	/**
	 * 难度
	 */
	private int difficulty;
	
	/**
	 * 奖励
	 */
	private int reward;
	
	/**
	 * 关卡时长
	 */
	private int time;
	
	/**
	 * 层数奖励
	 */
	private Map floorReward;
	
	/**
	 * 排序
	 */
	private int order;
	
	/**
	 * 所属日期
	 */
	private int week;
	
	
	
	public static EndlessCloisterLevelCfg builder() {
		EndlessCloisterLevelCfg endlessCloisterLevelCfg = new EndlessCloisterLevelCfg();
		return endlessCloisterLevelCfg;
	}
	
	/**
	 * id
	 */
	public int getId() {
		return id;
	}
	
	/**
	 * 难度
	 */
	public int getDifficulty() {
		return difficulty;
	}
	
	/**
	 * 奖励
	 */
	public int getReward() {
		return reward;
	}
	
	/**
	 * 关卡时长
	 */
	public int getTime() {
		return time;
	}
	
	/**
	 * 层数奖励
	 */
	public Map getFloorReward() {
		return floorReward;
	}
	
	/**
	 * 排序
	 */
	public int getOrder() {
		return order;
	}
	
	/**
	 * 所属日期
	 */
	public int getWeek() {
		return week;
	}
	
	
	protected Object[] getColumnNames(DataModelKeyEnum e){
		switch (e) {
		case SOURCE:
			return SOURCE_COLUMN_NAMES;
		case PINGYING:
			return PINGYING_COLUMN_NAMES;
		case HASHCODE:
			return HASHCODE_COLUMN_NAMES;
		case REMARKS:
			return SOURCE_COLUMN_REMARKS;
		default:
			return PINGYING_COLUMN_NAMES;
		}
	}
	
	protected String[] getBasicTypes(){
		return COLUMN_BASICTYPES;
	}
	
	protected Class[] getClassTypes(){
		return COLUMN_CLASSTYPES;
	}
	
	protected Object[] getColumeValues(){
		Object[] values = new Object[COLUMN_COUNT];
        values[0] = this.id;
        values[1] = this.difficulty;
        values[2] = this.reward;
        values[3] = this.time;
        values[4] = this.floorReward;
        values[5] = this.order;
        values[6] = this.week;
        return values;
	}
	
	protected EndlessCloisterLevelCfg createColumeValues(Object[] vals) {
		this.id = (int)vals[0];
		this.difficulty = (int)vals[1];
		this.reward = (int)vals[2];
		this.time = (int)vals[3];
		this.floorReward = (Map)vals[4];
		this.order = (int)vals[5];
		this.week = (int)vals[6];
		return this;
	}
	
	protected Map<Object, Object> toMap(Object[] keys,Map<Object, Object> map){
        map.put(keys[0], this.id);
        map.put(keys[1], this.difficulty);
        map.put(keys[2], this.reward);
        map.put(keys[3], this.time);
        map.put(keys[4], this.floorReward);
        map.put(keys[5], this.order);
        map.put(keys[6], this.week);
        return map;
    }
    
    protected EndlessCloisterLevelCfg createForMap(Object[] keys,Map map){
   		this.id = (int)map.get(keys[0]);
   		this.difficulty = (int)map.get(keys[1]);
   		this.reward = (int)map.get(keys[2]);
   		this.time = (int)map.get(keys[3]);
   		this.floorReward = (Map)map.get(keys[4]);
   		this.order = (int)map.get(keys[5]);
   		this.week = (int)map.get(keys[6]);
        return this;
    }
	
	
	protected JSONObject toJSONObject(Object[] keys,JSONObject obj){
        obj.put(keys[0], this.id);
        obj.put(keys[1], this.difficulty);
        obj.put(keys[2], this.reward);
        obj.put(keys[3], this.time);
        obj.put(keys[4], this.floorReward);
        obj.put(keys[5], this.order);
        obj.put(keys[6], this.week);
        return obj;
    }
    
    protected EndlessCloisterLevelCfg createForJSONObject(Object[] keys,JSONObject obj){
	    this.id = obj.getIntValue(keys[0]);
	    this.difficulty = obj.getIntValue(keys[1]);
	    this.reward = obj.getIntValue(keys[2]);
	    this.time = obj.getIntValue(keys[3]);
		this.floorReward = obj.getObject(keys[4],Map.class);
	    this.order = obj.getIntValue(keys[5]);
	    this.week = obj.getIntValue(keys[6]);
        return this;
    }
    
    protected void writeBytes(IByteBuff byteBuf){
	    byteBuf.writeInt(this.id);
	    byteBuf.writeInt(this.difficulty);
	    byteBuf.writeInt(this.reward);
	    byteBuf.writeInt(this.time);
	    byteBuf.writeObject(this.floorReward);
	    byteBuf.writeInt(this.order);
	    byteBuf.writeInt(this.week);
    }
	
	protected EndlessCloisterLevelCfg readBytes(IByteBuff byteBuf){
	    this.id = byteBuf.readInt(null);
	    this.difficulty = byteBuf.readInt(null);
	    this.reward = byteBuf.readInt(null);
	    this.time = byteBuf.readInt(null);
	    this.floorReward = (Map)byteBuf.readObject();
	    this.order = byteBuf.readInt(null);
	    this.week = byteBuf.readInt(null);
	    return this;
	}
	
	public EndlessCloisterLevelCfg deepCopy(){
		EndlessCloisterLevelCfg endlessCloisterLevelCfg = null;
		try {
			endlessCloisterLevelCfg = (EndlessCloisterLevelCfg) super.clone();
		    endlessCloisterLevelCfg.floorReward = ToolCopy.copyObject(this.floorReward);
			return endlessCloisterLevelCfg;
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return endlessCloisterLevelCfg;
	}
//自定义内容起始位置
//自定义内容结束位置
}
